<?php

class Application_Form_Support extends Zend_Form
{
    private $view;
    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
        $this->view = Zend_Layout::getMvcInstance()->getView();
        $this->setAttribs(array("id"=>"form_support","name"=>"form_support"));
        
        // create id element
        $id = $this->createElement("hidden","idsupports");
        $id->setDecorators(array("ViewHelper"));
        $this->addElement($id);
        
        //create element fullname
        $fullname = $this->createElement("text","fullname");
        $fullname->setLabel("Họ tên")
                     ->setRequired()
                     ->addValidators(array(
                        array("NotEmpty",false,array("messages"=>array('isEmpty'=>"Tên người hổ trợ không để trống."))),
                     ))
                     ->setAttrib("size","50");            
        $this->addElement($fullname);
        
        
        
        // Nếu có user
        $users_id = $this->createElement("select","users_id");
        $users_id->setLabel("Chọn tài khoản")
                 ->setDescription("(Nếu có sẵn một tài khoản)");
        $this->addElement($users_id);
        
        //create element phone
        $phone = $this->createElement("text","phone");
        $phone->setLabel("Điện thoại")
              ->setAttrib("size","50");            
        $this->addElement($phone);
        
        //create element address
        $address = $this->createElement("text","address");
        $address->setLabel("Địa chỉ")
              ->setAttrib("size","100");            
        $this->addElement($address);
        
        //create element yahoo
        $yahoo = $this->createElement("text","yahoo");
        $yahoo->setLabel("Nick Yahoo")
              ->setAttrib("size","50");            
        $this->addElement($yahoo);
        
        //create element sky
        $sky = $this->createElement("text","sky");
        $sky->setLabel("Nick Sky")
              ->setAttrib("size","50");            
        $this->addElement($sky);
        
        //create element type
        $sky = $this->createElement("text","type");
        $sky->setLabel("Loại")
            ->setDescription("(Kinh doanh, Kỹ thuật, Tư vấn...)")
            ->setAttrib("size","50");            
        $this->addElement($sky);
        
        // create submit button
        $submit = $this->createElement("submit","submit");
        $submit->setLabel("Thêm mới")
               ->setAttrib("class","btn btn-black");
        $this->addElement($submit);
        
        // create submit button
        $link = $this->view->url(array(
            'module'=>"admin",
            'controller'=>"support",
            'action'=>"index"
        ));
        $cancel = $this->createElement("button","cancel");
        $cancel->setLabel("Quay lại")
               ->setAttrib("class","btn btn-red")
               ->setAttrib("onclick","window.location='$link'");
        $this->addElement($cancel);  
        
        
    }

}

